---
title: Migrate from React Native CLI to Expo CLI
sidebar_title: Migrate to Expo CLI
description: Learn how to migrate from React Native CLI (@react-native-community/cli) to Expo CLI for any React Native project.
---

import { DocsLogo, RouterLogo } from '@expo/styleguide';
import { BookOpen02Icon } from '@expo/styleguide-icons/outline/BookOpen02Icon';

import { BoxLink } from '~/ui/components/BoxLink';
import { Collapsible } from '~/ui/components/Collapsible';
import { Terminal } from '~/ui/components/Snippet';
import { DEMI } from '~/ui/components/Text';

To migrate from React Native CLI (`npx @react-native-community/cli@latest init`) to Expo CLI, you'll need to install the `expo` package, which includes the Expo Modules API and Expo CLI. This guide covers the installation step, the benefits of using Expo CLI, and how to compile and run your project after migrating to Expo CLI.

It is strongly recommended to use Expo CLI when using other Expo tools. It is required for many tools, such as EAS Update, Expo Router, and expo-dev-client, and other features may not work as well without it.

## Install the `expo` package

In most cases, executing the following command in a project directory to install the package is all you need to do:

<Terminal cmd={['$ npx install-expo-modules@latest']} />

For a detailed installation guide, see [Install Expo modules](/bare/installing-expo-modules).

> **info** After installing the `expo` package, you'll need to configure your project to use Expo CLI. This includes setting up Metro config, Babel preset, and native project configurations. See the [Configure Expo CLI for bundling on Android and iOS](/bare/installing-expo-modules/#configure-expo-cli-for-bundling-on-android-and-ios) section for the complete setup instructions.

## Why Expo CLI instead of React Native CLI

Expo CLI commands provide several benefits over the similar commands in `@react-native-community/cli`, which includes:

- Instant access to Hermes debugger with <kbd>j</kbd> keystroke.
- The debugger ships with [React Native DevTools](/debugging/tools/#debugging-with-react-native-devtools).
- [Continuous Native Generation (CNG)](/workflow/continuous-native-generation/) support with [`expo prebuild`](/workflow/prebuild/) for upgrades, white-labeling, easy third-party package setup, and better maintainability of the codebase (by reducing the surface area).
- Support for file-based routing with [`expo-router`](/router/introduction/).
  - [Async bundling](/router/web/async-routes) in development.
- Built-in [environment variable support](/guides/environment-variables) and **.env** file integration.
- View native logs directly in the terminal alongside JavaScript logs.
- Improved native build log formatting using Expo CLI's `xcpretty`-style tool built specifically for React Native apps. For example, when compiling a Pod, you can see which Node module included it.
- [First-class TypeScript support](/guides/typescript).
- Support for **tsconfig.json** aliases with `paths` and `baseUrl` [built-in to Metro](/guides/typescript/#path-aliases-optional).
- [Web support](/guides/customizing-metro/#adding-web-support-to-metro) with Metro. Fully typed for React Native Web.
- Modern [CSS support](/versions/latest/config/metro#css) with Tailwind, PostCSS, CSS Modules, SASS, and more.
- Static site generation with Expo Router and Metro web.
- Out of the box [support for monorepos](/guides/monorepos).
- Support for Expo tooling such as [`expo-dev-client`](/develop/development-builds/introduction), the [Expo Updates protocol](/technical-specs/expo-updates-1) and [EAS Update](/eas-update/introduction).
- Automated `pod install` execution when using `npx expo run:ios`.
- `npx expo install` selects compatible dependency versions for well-known packages.
- Automatic port detection when running `npx expo run:[android|ios]` and `npx expo start`. If another app is running on the default port, a different port is used.
- Android or iOS device launch selection shortcuts using <kbd>Shift</kbd> + <kbd>a</kbd> or <kbd>Shift</kbd> + <kbd>i</kbd> from the interactive prompt.
- Built-in support for serving your app over an [ngrok tunnel](/develop/development-builds/development-workflows/#tunnel-urls).
- Develop on any port with any entry JavaScript file.

We recommend Expo CLI for most React Native projects that target Android, iOS, and/or web. It does not yet have built-in support for the most popular out-of-tree platforms, such as
Windows and macOS. If building for these platforms, you can utilize Expo CLI for the supported platforms and `@react-native-community/cli` for the others.

## Compile and run your app

After installing the `expo` package, you can use the following commands which are alternatives to `npx react-native run-android` and `npx react-native run-ios`:

<Terminal
  cmd={['# for Android', '$ npx expo run:android', '', '# for iOS', '$ npx expo run:ios']}
/>

When building your project, you can choose a device or simulator by using the `--device` flag. This also applies to any iOS device that is connected to your computer.

## Start the bundler independently

`npx expo run:[android|ios]` automatically starts the bundler/development server. If you want to independently start the bundler with `npx expo start` command, pass the `--no-bundler` to the `npx expo run:[android|ios]` command.

## Common questions

<Collapsible summary="Can I use Expo CLI without installing the Expo Modules API?">

Expo Modules API is also installed when you install the `expo` package with `npx install-expo-modules`. If you want to try out Expo CLI for now without installing Expo Modules API, install the `expo` package with `npm install` and then configure the **react-native.config.js** to exclude the package from autolinking:

```js react-native.config.js
module.exports = {
  dependencies: {
    expo: {
      platforms: {
        android: null,
        ios: null,
        macos: null,
      },
    },
  },
};
```

> **Note:** Without Expo API Modules installed, certain features such as `expo-dev-client` or `expo-router` are unavailable.

</Collapsible>

<Collapsible summary="Can I use prebuild for out-of-tree platforms, such as macOS or Windows?">

Yes! Refer to the [Customized Prebuild Example repository](https://github.com/byCedric/custom-prebuild-example) for more information.

</Collapsible>

## Next steps

Now, with the `expo` package installed and configured in your project, you can start using all features from Expo CLI and SDK. Here are some recommended next steps to dive deep:

<BoxLink
  title="Expo CLI Reference"
  description="Learn more about the commands and flags available in Expo CLI."
  href="/more/expo-cli"
  Icon={BookOpen02Icon}
/>
<BoxLink
  title="Customizing Metro"
  description="Learn how to customize the Metro bundler configuration for your project."
  href="/guides/customizing-metro"
  Icon={BookOpen02Icon}
/>
<BoxLink
  title="Adopt Prebuild"
  description={
    <>
      Automate your native directories using the <DEMI>app.json</DEMI>.
    </>
  }
  href="/guides/adopting-prebuild"
  Icon={BookOpen02Icon}
/>
<BoxLink
  title="Use Expo SDK"
  description="Try out libraries from the Expo SDK in your app."
  href="/versions/"
  Icon={DocsLogo}
/>
<BoxLink
  title="Expo Router"
  description="Expo Router brings the best routing concepts from the web to native Android and iOS apps."
  href="/router/introduction/"
  Icon={RouterLogo}
/>
